home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d7 / lanuts.arc / LANTASTI.ASM < prev    next >
Assembly Source File  |  1991-10-30  |  7KB  |  259 lines

  1. ; ***************************************************************************
  2. ; Assembly language functions for LANtastic
  3. ; 01/07/88 JEM Created
  4. ; 02/18/91 JEM Updated for use w/MASM 5.1
  5. ; ***************************************************************************
  6.  
  7. .MODEL COMPACT,C
  8. .CODE
  9.  
  10. ;
  11. ; Name:        nos_present
  12. ; Function: Determines whether or not LANtastic is running
  13. ; Caller:   MSC 4.0, Compact
  14. ; Args:     none
  15. ;        returns TRUE or FALSE (1 or 0)
  16. ; Author:   JM
  17. ; Date:     10/26/89
  18. ;
  19. nos_present PROC NEAR USES ES DS SI DI
  20.     mov    ax,0B800H
  21.     int    2Fh
  22.     and    al,al        ; test result
  23.     jnz    nos_ok        ; if nz, LANtastic is running
  24.     xor    ax,ax        ; LANtastic isn't running
  25.     jmp    nos_end        ; return to caller
  26. nos_ok:
  27.     xor    ax,ax
  28.     inc    ax        ; return TRUE
  29. nos_end:
  30.         ret
  31. nos_present ENDP
  32.  
  33. ;
  34. ; Name:     get_inactive_server
  35. ; Function: Returns the name of a LANtastic server that you are not
  36. ;        logged into. Returns TRUE if no error, FALSE if error
  37. ; Caller:   MS C compact model
  38. ; Args:     get_inactive_server(buffer,index)                     
  39. ;             unsigned char *buffer;   /* 16 byte buffer */
  40. ;             int index;               /* index of server name entry */
  41. ; Author:   JEM
  42. ; Date:     8/17/89
  43. ;
  44. get_inactive_server PROC NEAR USES ES DS SI DI, buffer:PTR, index:WORD
  45.  
  46. ; set up LANOS function call
  47.         les    di,buffer               ; ES:DI points to buffer
  48.      mov     bx,index        
  49.     mov     ax,5F84H        ; Get inactive server fn.
  50.     int    21H            ; Call function
  51.     
  52. ; Process results
  53.     jc    GIS_ERR            ; we have an error
  54. ; Success! - we found an inactive server
  55.         mov    ax,1
  56.     jmp     GIS_DONE        
  57.     
  58. ; Failure - no inactive servers    
  59. GIS_ERR:        
  60.         xor     ax,ax            ; set up FALSE return code    
  61.  
  62. ; we're done -- clean up and go home
  63. GIS_DONE:
  64.         ret
  65. get_inactive_server ENDP
  66.  
  67. ;
  68. ; Name:     get_active_server
  69. ; Function: Returns the name of a LANtastic server that you are 
  70. ;        logged into. Returns TRUE if no error, FALSE if error
  71. ; Caller:   MS C compact model
  72. ; Args:     get_active_server(buffer,index)                     
  73. ;             unsigned char *buffer;   /* 16 byte buffer */
  74. ;             int index;               /* index of server name entry */
  75. ; Author:   JEM
  76. ; Date:     8/17/89
  77. ;
  78. get_active_server PROC NEAR USES ES DS SI DI, buffer:PTR, index:WORD
  79.     mov    ax,5F80h        ; Get login entry fcn
  80.     les    di,buffer        ; Point to receiving buffer
  81.     mov    bx,index        ; index entry 
  82.     int     21h            ; Call LANOS
  83. ; Process results
  84.     jc    GAS_ERR            ; we have an error
  85. ; Success! - we found an active server
  86.         mov    ax,1
  87.     jmp     GAS_DONE        
  88.     
  89. ; Failure - no active servers    
  90. GAS_ERR:        
  91.         xor     ax,ax            ; set up FALSE return code    
  92.  
  93. ; we're done -- clean up and go home
  94. GAS_DONE:
  95.         ret
  96. get_active_server ENDP
  97.  
  98.  
  99. ;
  100. ; Name:     login
  101. ; Function: Attempts to log into a LANtastic server 
  102. ;        Returns an error code -- 0 if no error
  103. ; Caller:   MS C compact model
  104. ; Args:     login(buffer)                     
  105. ;             unsigned char *buffer;   /* login path buffer */
  106. ; Author:   JEM
  107. ; Date:     8/17/89
  108. ;
  109. login PROC NEAR USES ES DS SI DI, buffer:PTR 
  110.  
  111. ; call the LANOS login function
  112.     les    di,buffer        ; ES:DI points to buffer    
  113.     mov    bl,0ffh            ; try all valid adapters
  114.     mov    ax,5F81h        ; login subfn
  115.     int     21h            ; call function.
  116.         
  117. ; process the result
  118.     jc    LOG_DONE        ; if CS, we have a problem
  119.     xor    ax,ax            ; else, return a happy 0
  120.  
  121. ; we're done -- clean up and go home
  122. LOG_DONE:
  123.         ret
  124. login ENDP
  125.  
  126. ;
  127. ; Name:     logout
  128. ; Function: Attempts to log out of a  LANtastic server 
  129. ;        Returns an error code -- 0 if no error
  130. ; Caller:   MS C compact model
  131. ; Args:     logout(buffer)                     
  132. ;             unsigned char *buffer;   /* login path buffer */
  133. ; Author:   JEM
  134. ; Date:     8/17/89
  135. ;
  136. logout PROC NEAR USES ES DS SI DI, buffer:PTR 
  137.  
  138. ; call the LANOS login function
  139.     les    di,buffer        ; ES:DI points to buffer    
  140.     mov    ax,5F82h        ; logout
  141.     int     21h            ; call function.
  142.         
  143. ; process the result
  144.     jc    OUT_DONE        ; if CS, we have a problem
  145.     xor    ax,ax            ; else, return a happy 0
  146.  
  147. ; we're done -- clean up and go home
  148. OUT_DONE:
  149.         ret
  150. logout ENDP
  151.  
  152. ;
  153. ; Name:     get_error_text
  154. ; Function: Convert LANOS error code to text form
  155. ;           returns a far pointer to the error text string
  156. ; Caller:   MSC compact
  157. ; Args:     get_error_text(code)
  158. ; Author:   JEM
  159. ; Date:     8/23/89
  160. ;
  161. get_error_text PROC NEAR USES ES DS SI DI, errcode:WORD
  162.     mov    ah,5            ; Expand error code fcn
  163.     mov    al,byte ptr (errcode)            
  164.     mov    bx,errcode
  165.     int    02Fh            ; Multiplex interrupt
  166.  
  167.         mov     dx,es                   ; return far ptr to string
  168.         mov     ax,di
  169.     
  170.         ret
  171. get_error_text ENDP
  172.     
  173. halt PROC NEAR
  174.     hlt
  175. halt ENDP
  176.     
  177. ;
  178. ; Name:     redirect_device
  179. ; Function: Redirects a device on the network
  180. ; Caller:   MSC compact
  181. ; Args:     redirect_device(device,netpath,dtype)
  182. ;        char *device,*netpath;
  183. ;        int dtype;
  184. ; Author:   JEM
  185. ; Date:     8/23/89
  186. ;
  187. redirect_device PROC NEAR USES ES DS SI DI, device:PTR, netpath:PTR, dtype:WORD
  188.     lds    si,device        ; Device to redirect in DS:SI
  189.     les    di,netpath        ; Network path in ES:DI
  190.     mov    bl,byte ptr (dtype)     ; 3 if printer, 4 if disk
  191.     mov    cx,0            ; Value to store w/ device
  192.     mov    ax,5F03h        ; LANOS redirect function
  193.     int    21h            ; redirect the device
  194.     
  195. ; process the result
  196.     jc    RE_DONE         ; if CS, we have a problem
  197.     xor     ax,ax            ; else, return 0
  198.  
  199. ; we're done -- clean up and go home
  200. RE_DONE:
  201.         ret
  202. redirect_device ENDP
  203.  
  204. ;
  205. ; Name:     cancel_redirection
  206. ; Function: Cancel a network redirection
  207. ; Caller:   MSC compact
  208. ; Args:     cancel_redirection(device)
  209. ;        char *device
  210. ; Author:   JEM
  211. ; Date:     8/23/89
  212. ;
  213. cancel_redirection PROC NEAR USES ES DS SI DI, device:PTR 
  214.     lds    si,device        ; Device to redirect in DS:SI
  215.     mov    ax,5F04h        ; LANOS cancel redirect function
  216.     int    21h            ; cancel the redirection
  217.     
  218. ; process the result
  219.     jc    CR_DONE         ; if CS, we have a problem
  220.     xor     ax,ax            ; else, return 0
  221.  
  222. ; we're done -- clean up and go home
  223. CR_DONE:
  224.         ret
  225. cancel_redirection ENDP
  226.  
  227. whoami PROC NEAR USES DS SI, node:PTR 
  228.     lds    dx,node        ; Point DS:DX to name buffer
  229.     mov    ax,05E00h    ; Get machine name fcn
  230.     int    21h        ; do it
  231.         ret
  232. whoami ENDP
  233.  
  234. ;
  235. ; Name:        get_user_info
  236. ; Function: 
  237. ; Caller:   MSC 4.0, Compact
  238. ; Args:     int get_user_info(server,index,buffer)    
  239. ;             char *server;
  240. ;          int index;
  241. ;          ACTIVE_USER *buffer; /* defined in LANTASTI.H */
  242. ; Author:   JM
  243. ; Date:    10/31/89 
  244. get_user_info PROC NEAR USES ES DS SI DI, server:PTR, index:WORD, buffer:PTR
  245.     mov    bx,index        ; Number of login entry.
  246.     les    di,server               ; Server to query
  247.     lds    si,buffer        ; Buffer for result
  248.     mov    ax,5FB0H        ; LANOS get active user info fn.
  249.     int    21H            ; Get user info.
  250.     
  251. ; process the result
  252.     jc    GUI_DONE        ; if carry set, there was an error
  253.     xor    ax,ax              ; otherwise, return 0    
  254. GUI_DONE:    
  255.         ret
  256. get_user_info ENDP
  257.  
  258. END
  259.